//
//  AVPlayer+player.m
//  Atlantis
//
//  Created by 何恩营 on 14-12-24.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "AVPlayer+player.h"

@implementation AVPlayer (player)

+ (AVPlayer *)shareAVPlayer
{
    static AVPlayer *avPlayer;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        avPlayer = [[AVPlayer alloc] init];
    });
    return avPlayer;

}

- (void)playWithURL:(NSURL *)url isPlay:(BOOL)flag
{
    AVPlayerItem *item = [AVPlayerItem playerItemWithURL:url];
    
    [self replaceCurrentItemWithPlayerItem:item];
    if (flag) {
        [self play];
    }
}



@end
